package com.euond.permission.controller;

import com.euond.common.core.dto.ResultDto;
import com.euond.common.web.controller.BaseCRUDController;
import com.euond.permission.dto.UserRoleResourceDto;
import com.euond.permission.entities.Role;
import com.euond.permission.service.RoleService;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by user on 2017/7/14.
 */
@RestController
@RequestMapping("permission/front/roles")
public class RoleController extends BaseCRUDController<RoleService,Role> {

    /**
     * 按角色批量增加用户角色、角色资源关系
     */
    @PostMapping("userroleresource")
    @ResponseStatus(HttpStatus.CREATED)
    public ResultDto addUserRoleResource(@RequestBody UserRoleResourceDto userRoleResourceDto) {
        if(userRoleResourceDto!=null){
            baseService.addUserRoleResource(userRoleResourceDto);
            return new ResultDto("0","seccess");
        }else{
            return new ResultDto("9009","角色关系数据为空！");
        }


    }
}
